package com.spring.service;

import com.spring.mapper.BookMapper;
import com.spring.pojo.Book;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class BookService {
    @Autowired
    BookMapper bookMapper;

    public int addBook(Book book){
        return bookMapper.addBook(book);
    }
    public int updateBook(Book book){
        return bookMapper.updateBook(book);
    }
    public int deleteBook(Integer id){
        return bookMapper.deleteBook(id);
    }
    public Book getBookById(Integer id){
        return bookMapper.getBookById(id);
    }
    public List<Book> getAllBook(){
        return bookMapper.getAllBook();
    }
}
